package com.note;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.spring.web.SpringfoxWebMvcConfiguration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import com.note.utils.IdWorker;

/**
 * @ClassName ServiceApplication
 * @Description TODO
 * @Author QiBin
 * @Date 2020/5/3116:18
 * @Version 1.0
 **/
@SpringBootApplication
@EnableSwagger2
@EnableScheduling
@EnableAsync
@ConditionalOnClass(SpringfoxWebMvcConfiguration.class)
public class ServiceApplication implements WebMvcConfigurer {

    public static void main(String[] args) {
        SpringApplication.run(ServiceApplication.class, args);
    }


    @Bean
    public IdWorker idWorkker() {
        return new IdWorker(1, 1);
    }
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
//        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
//    }
}
